﻿using System;

namespace Chromium_Updater
{
    static class Settings
    {
        static IniFile ini;

        static Settings()
        {
            ini = new IniFile(System.Windows.Forms.Application.StartupPath + "\\settings.ini");
        }

        public static int CheckInterval
        {
            get { return ini.GetInt32("Settings", "CheckInterval", 300) * 1000; }
            set { ini.WriteValue("Settings", "CheckInterval", value); }
        }

        public static int LocalVersion
        {
            get { return ini.GetInt32("Settings", "LocalVersion", 0); }
            set { ini.WriteValue("Settings", "LocalVersion", value); }
        }

        public static int DownloadAs
        {
            get { return ini.GetInt32("Settings", "DownloadAs", 0); }
            set { ini.WriteValue("Settings", "DownloadAs", value); }
        }

        public static bool Install
        {
            get { return Convert.ToBoolean(ini.GetInt32("Settings", "Install", 1)); }
            set { ini.WriteValue("Settings", "Install", Convert.ToInt32(value)); }
        }

        public static bool DeleteAfter
        {
            get { return Convert.ToBoolean(ini.GetInt32("Settings", "DeleteAfter", 1)); }
            set { ini.WriteValue("Settings", "DeleteAfter", Convert.ToInt32(value)); }
        }

        public static string DownloadTo
        {
            get { return ini.GetString("Settings", "DownloadTo", System.Windows.Forms.Application.StartupPath + "\\Downloads"); }
            set { ini.WriteValue("Settings", "DownloadTo", value); }
        }

        public static bool AppendFileName
        {
            get { return Convert.ToBoolean(ini.GetInt32("Settings", "AppendFileName", 0)); }
            set { ini.WriteValue("Settings", "AppendFileName", Convert.ToInt32(value)); }
        }

        public static bool MinimizeOnStart
        {
            get { return Convert.ToBoolean(ini.GetInt32("Settings", "MinimizeOnStart", 0)); }
            set { ini.WriteValue("Settings", "MinimizeOnStart", Convert.ToInt32(value)); }
        }

        public static bool HideDownloader
        {
            get { return Convert.ToBoolean(ini.GetInt32("Settings", "HideDownloader", 0)); }
            set { ini.WriteValue("Settings", "HideDownloader", Convert.ToInt32(value)); }
        }

        public static bool OpenChromiumAfter
        {
            get { return Convert.ToBoolean(ini.GetInt32("Settings", "OpenChromiumAfter", 0)); }
            set { ini.WriteValue("Settings", "OpenChromiumAfter", Convert.ToInt32(value)); }
        }
    }
}
